package com.example.basic.thread;

import java.util.concurrent.*;

public class ThreadTest {

    public static void main(String[] args) throws InterruptedException, ExecutionException {

        Model model = new Model();
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    model.max++;
                }
                System.out.println(model.max);
            }
        };

        new Thread(runnable).start();
        new Thread(runnable).start();
        new Thread(runnable).start();
        new Thread(runnable).start();
        new Thread(runnable).start();
        new Thread(runnable).start();
        new Thread(runnable).start();
        new Thread(runnable).start();
    }

    private static class Model {
        public int max = 1;
    }

}

